﻿namespace ReplayLastMessageMessenger.ViewModel.Messages
{
    using System;

    /// <summary>
    /// Base of messages sent back
    /// </summary>
    public abstract class BaseMessage
    {
        #region Constants and Fields

        /// <summary>
        /// Exception
        /// </summary>
        private Exception exception;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMessage"/> class.
        /// </summary>
        public BaseMessage()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMessage"/> class.
        /// </summary>
        /// <param name="ex">
        /// The ex.
        /// </param>
        public BaseMessage(Exception ex)
        {
            this.exception = ex;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the exception
        /// </summary>
        public Exception Exception
        {
            get
            {
                return this.exception;
            }

            internal set
            {
                this.exception = value;
            }
        }

        /// <summary>
        /// Request failed
        /// </summary>
        public bool Failed
        {
            get
            {
                return this.exception != null;
            }
        }

        #endregion
    }
}